
<html>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> 
<head>
<script>
function OuvrirPopup(page) {
      window.open(page, "comments", "toolbar=no, status=yes, scrollbars=yes, resizable=yes, width=1230, height=600");
}
</script>
<script src="../../../../global-themis/js/jquery.js"></script>
<script src="../../../../global-themis/js/jquery.tablescroll.js"></script>
<link rel='stylesheet' type='text/css' href='../../../../global-themis/css/themisstyle.css'/>				
		<script>
			$(document).ready(function(){
				$('#alerte_com').tableScroll('undo');
			});

		</script>
<?php

include ("../../../../global-themis/functions/function_graph_2.php");
include ("../../../../PCO.php");
include ("../../../../global-themis/functions/functions.php");
include ("../../../../global-themis/Classes/client.class");
$rem=array();
$num_cli="";
$content="";
$count="";
if(isset($_GET['num_cli'])){
	$num_cli=$_GET['num_cli'];
	if(strlen($num_cli)==6)
	$num_cli="0".$num_cli."";
	$client= new Client();
	$client->setNum($num_cli);
	$rem=$client->getAlerteCommerciale($num_cli);
	$count=count($rem);	
	// c'est pour eviter l'affichage du scrollbar-x donc on ajoute des lignes vides si la taille de $rem <6.
	if($count < 6) {
		$count=6 -$count;
	}
	else {
		$count=0;
	}
	if(empty($rem)){
		//construction du tableau.
		$content.="Aucune Alerte trouvee...";
	}
	else {
		$content.="<table id='alerte_com' class='tablescroll' width='100%'>
				   <thead>
					   <td>DATE</td>
					   <td>MSG</td>
					   <td>VUE</td>
					</thead>
					<tbody>";
		foreach($rem as $r){
			if($r['CRMMESTRA']=="0"){
				$r['CRMMESTRA']="N";
				$content.="<tr class='red'><td>".splitDate($r['CRMMESDEX'])."<td>".$r['CRMMESCCO']."<td>".$r['CRMMESTRA']."</td></tr>";
			}
			else {
				$r['CRMMESTRA']="O";
				$content.="<tr class='green'><td>".splitDate($r['CRMMESDEX'])."<td>".$r['CRMMESCCO']."<td>".$r['CRMMESTRA']."</td></tr>";
			}	
		}
		$i=0;
		if($count >0)
			while($i<$count) {
				$content.="<tr><td colspan='7'>&nbsp;</td></tr>";
				$i++;
			}
		$content.="</tbody></table>";
	}
}
?>

</head>
<body>
<div>
10 dernieres alertes commerciales:
<div id='container'>
	<?php
		echo $content;
	?>
</div>
</body>
</html>